package com.design.testdemo.app;

import android.app.Application;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheMode;

/**
 * @Auther: Timmy
 * @Data: 2017/6/7
 * @Fuction:
 */

public class MyApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        //必须调用初始化
        OkGo.init(this);

        OkGo.getInstance()
                .setConnectTimeout(OkGo.DEFAULT_MILLISECONDS)  //全局的连接超时时间
                .setRetryCount(3)
                //可以全局统一设置缓存模式,默认是不使用缓存,可以不传,具体其他模式看 github 介绍 https://github.com/jeasonlzy/
                .setCacheMode(CacheMode.REQUEST_FAILED_READ_CACHE);

    }
}
